﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using System.Linq;

namespace Test.Mjollnir.IO
{
    [TestClass]
    public class StreamExtensionsTest
    {
        [TestMethod]
        public void CopyToTest1()
        {
            var bytes = Enumerable.Range(0, 100 * 1024).Select(_ => (byte)_).ToArray();

            using (var source = new MemoryStream(bytes))
            using (var desitination = new MemoryStream())
            {
                source.CopyTo(desitination);

                var expected = bytes;
                var actual = desitination.ToArray();

                Assert.AreEqual(expected.Length, actual.Length);
                Assert.IsTrue(Enumerable.Range(0, expected.Length).All(_ => expected[_] == actual[_]));
            }
        }
    }
}
